package fr.uniscol.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;

import fr.uniscol.siecle.model.ScolariteAnneeDerniere;

public class Eleve implements Serializable {

	private BaseAnneeScolaire base = null;
	
	private long id = 0;
	
	private String ine = null;
	
	private String nom = null;
	
	private String prenom = null;
	
	private String idSiecle = null;
	
	private List<Scolarite> scolarites = null;
	
	private List<NotationDevoir> notes = null;

	public Eleve(){
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public BaseAnneeScolaire getBase() {
		return base;
	}

	public void setBase(BaseAnneeScolaire base) {
		this.base = base;
	}

	public String getIdSiecle() {
        if(idSiecle == null){
            idSiecle = "";
        }
		return idSiecle;
	}

	public void setIdSiecle(String idSiecle) {
		this.idSiecle = idSiecle;
	}

	public String getIne() {
		return ine;
	}

	public void setIne(String ine) {
		this.ine = ine;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public List<NotationDevoir> getNotes() {
		if(notes == null){
			notes = new ArrayList<NotationDevoir>();
		}
		return notes;
	}

	public void setNotes(List<NotationDevoir> notes) {
		this.notes = notes;
	}

	public List<Scolarite> getScolarites() {
		if(scolarites == null){
			scolarites = new ArrayList<Scolarite>();
		}
		return scolarites;
	}

	public void setScolarites(List<Scolarite> scolarites) {
		this.scolarites = scolarites;
	}

	public Scolarite getScolariteActuelle(){
		for(Scolarite s : getScolarites()){
			if(s.isActuelle()){
				return s;
			}
		}
		return null;
	}
	
	public Scolarite findScolariteById(int scolariteid) {
		
		for(Scolarite sc : getScolarites()){
			if(sc.getId() == scolariteid){
				return sc;
			}
		}
		
		return null;
	}
}
